import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css'
import i18n from './locales'
import router from './router'
import store from './store'
import App from './App.vue'
import scui from './scui.js'
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import dataV from '@jiaminghi/data-view'
import * as echarts from "echarts";
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import mitt from 'mitt'
import $Bus from '@/utils/eventBus'

const app = createApp(App);
app.use(echarts);
app.use(dataV);
app.use(store);
app.use(router);
app.use(mitt);
app.use(ElementPlus, {
    locale: zhCn,
});
$Bus.on('foo', (params) => {
    console.log('params', params)
});
app.use(i18n);
app.use(scui);
$Bus.emit('foo', 42);
// 定义到全局
app.config.globalProperties.$Bus = $Bus

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
//挂载app
app.mount('#app');